package cn.iocoder.yudao.module.written.exam.service.writtenexammessage;

import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
import cn.iocoder.yudao.module.infra.api.websocket.WebSocketSenderApi;
import cn.iocoder.yudao.module.written.exam.controller.app.writtenexam.vo.message.AppWrittenExamMessageVO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class WrittenExamMessageServiceImpl implements WrittenExamMessageService {

    @Resource
    private WebSocketSenderApi webSocketSenderApi;

    @Override
    public void push(Long userId, String type, AppWrittenExamMessageVO appWrittenExamMessageVO) {
        // 通过 websocket 推送给在线指定的用户
        webSocketSenderApi.sendObject(UserTypeEnum.MEMBER.getValue(), userId, type, appWrittenExamMessageVO);
    }

}
